﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CFSystem.JXC.Model;
using CFSystem.JXC.IDAL;
using CFSystem.JXC.DALFactory;
using CFSystem.JXC.AccessDAL;

namespace CFSystem.JXC.BLL
{
    public class Vendor
    {
         // Get an instance of the Category DAL using the DALFactory
        // Making this static will cache the DAL instance after the initial load
        private static readonly IVendor dal = DALFactory.DataAccess.CreateVendor();

        public Vendor()
        { }
        /// <summary>
        /// Method to get all categories
        /// </summary>										
        /// <returns>Generic List of CategoryInfo</returns>	   		
        public IList<VendorInfo> GetVendors()
        {
            return dal.GetVendors();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public VendorInfo GetVendorByID(int ID)
        {
            return dal.GetVendor(ID);
        }
         /// <summary>
         /// insert Vendor into db.
         /// </summary>
         /// <param name="VendorName"></param>
        public void Insert(VendorInfo vendor)
        {
            //check name
            
            //insert
            dal.InsertVendor(vendor);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="VendorID"></param>
        public void Delete(int VendorID)
        {
            dal.DelVendorByID(VendorID);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="VendorID"></param>
        /// <param name="updValue"></param>
        public void Update(VendorInfo vendor)
        {
            dal.UpdateVendorByID(vendor);
        }

       
    }
}
